package mnn;

/*
 This program is written by Ahmed Medhat Ahmed
 Egypt
 Alexandria Universty
 Faculty of Science
 Computer Science
 7-7-2007
 a.medhat.cs@gmail.com
 ama_compsc@yahoo.com
 */
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Main extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = -967357046872302482L;

	public static void main(String[] args) {
		Main app = new Main();
		app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	private JPanel P_Top, P_Bottom;
	private Container container;
	private JLabel img_lbl;

	private JButton B_TrainN, B_TrainO, B_TrainU, B_Test;

	public Main() {
		super("Neural Networkes System");

		container = getContentPane();
		container.setLayout(new BorderLayout(5, 5));

		P_Top = new JPanel();
		P_Top.setLayout(new FlowLayout());

		img_lbl = new JLabel();
		Icon img = new ImageIcon("1.jpg");
		img_lbl.setIcon(img);
		P_Top.add(img_lbl);

		P_Bottom = new JPanel();
		P_Bottom.setLayout(new FlowLayout());

		B_TrainN = new JButton("Training new NN");
		B_TrainN
				.setToolTipText("Create a new Neural Networks with new structuer and new data ");
		B_TrainN.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new TrainN();
			}
		});
		P_Bottom.add(B_TrainN);

		B_TrainO = new JButton("Traning old NN");
		B_TrainO.setToolTipText("Train an old neural networks with new data ");
		B_TrainO.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new TrainO();
			}
		});
		P_Bottom.add(B_TrainO);

		B_TrainU = new JButton("Update NN");
		B_TrainU
				.setToolTipText("Train an old neural networks by adding new data to the old data");
		B_TrainU.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new TrainU();
			}
		});
		P_Bottom.add(B_TrainU);

		B_Test = new JButton("Test NN");
		B_Test.setToolTipText(" Test Neural Netwok");
		B_Test.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new Test();
			}
		});
		P_Bottom.add(B_Test);

		container.add(P_Top, BorderLayout.NORTH);
		container.add(P_Bottom, BorderLayout.SOUTH);

		setLocation(150, 50);
		setSize(550, 300);
		setVisible(true);
		setResizable(false);
	}
}